﻿using System;
using Microsoft.Xna.Framework;
using Terraria.GameContent.UI.Elements;
using Terraria.Localization;
using Terraria.UI;

namespace Terraria.ModLoader.UI
{
	// Token: 0x02000284 RID: 644
	internal class UIInfoMessage : UIState
	{
		// Token: 0x06001A41 RID: 6721 RVA: 0x004286AC File Offset: 0x004268AC
		public override void OnInitialize()
		{
			UIElement uielement = new UIElement();
			uielement.Width.Set(0f, 0.8f);
			uielement.Top.Set(200f, 0f);
			uielement.Height.Set(-240f, 1f);
			uielement.HAlign = 0.5f;
			UIPanel uipanel = new UIPanel();
			uipanel.Width.Set(0f, 1f);
			uipanel.Height.Set(-110f, 1f);
			uipanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
			uielement.Append(uipanel);
			this.message.Width.Set(-25f, 1f);
			this.message.Height.Set(0f, 1f);
			uipanel.Append(this.message);
			UIScrollbar uiscrollbar = new UIScrollbar();
			uiscrollbar.SetView(100f, 1000f);
			uiscrollbar.Height.Set(-20f, 1f);
			uiscrollbar.VAlign = 0.5f;
			uiscrollbar.HAlign = 1f;
			uipanel.Append(uiscrollbar);
			this.message.SetScrollbar(uiscrollbar);
			UITextPanel<string> uitextPanel = new UITextPanel<string>(Language.GetTextValue("tModLoader.OK"), 0.7f, true);
			uitextPanel.Width.Set(-10f, 0.5f);
			uitextPanel.Height.Set(50f, 0f);
			uitextPanel.Left.Set(0f, 0.25f);
			uitextPanel.VAlign = 1f;
			uitextPanel.Top.Set(-30f, 0f);
			uitextPanel.OnMouseOver += UICommon.FadedMouseOver;
			uitextPanel.OnMouseOut += UICommon.FadedMouseOut;
			uitextPanel.OnClick += this.OKClick;
			uielement.Append(uitextPanel);
			base.Append(uielement);
		}

		// Token: 0x06001A42 RID: 6722 RVA: 0x00012B5A File Offset: 0x00010D5A
		internal void SetMessage(string text)
		{
			this.message.SetText(text);
		}

		// Token: 0x06001A43 RID: 6723 RVA: 0x00012B68 File Offset: 0x00010D68
		internal void SetGotoMenu(int gotoMenu, UIState state = null)
		{
			this.gotoMenu = gotoMenu;
			this.gotoState = state;
		}

		// Token: 0x06001A44 RID: 6724 RVA: 0x00012B78 File Offset: 0x00010D78
		private void OKClick(UIMouseEvent evt, UIElement listeningElement)
		{
			Main.PlaySound(10, -1, -1, 1, 1f, 0f);
			Main.menuMode = this.gotoMenu;
			if (this.gotoState != null)
			{
				Main.MenuUI.SetState(this.gotoState);
			}
		}

		// Token: 0x04001781 RID: 6017
		private UIMessageBox message = new UIMessageBox("");

		// Token: 0x04001782 RID: 6018
		private int gotoMenu;

		// Token: 0x04001783 RID: 6019
		private UIState gotoState;
	}
}
